/*
 * Copyright (c) 2015 Minshenglife. All rights reserved.
 * Minshenglife PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 *
 */
package com.sentry.dao;

import com.sentry.entity.User;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;


/**
 * @author WuBo (wub1@minshenglife.com)
 *
 */
public interface UserDao extends PagingAndSortingRepository<User,Long> {
    
    
    Stream<User> findByUsername(String username);
    
    List<User> findByPasswd(String passwd);
    
    List<User> findByCreateTimeGreaterThan(LocalDateTime date);
    
    
    List<User> findByCreateTimeBetween(LocalDateTime start, LocalDateTime end);
    
    
    @Query("select t from User t where t.username=?1 and t.passwd=?2")
    Optional<User> findByUserInfo(String username, String passwd);
    

}
